package com.qfedu.spring.springmvc.controller;

import com.qfedu.spring.springmvc.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author zhang
 * @Title: commonValidateAdd
 * @date : 2022/5/3 14:45
 */
@Controller
@RequestMapping("/ajax")
public class AjaxController {

    //前端响应乱码解决方法：produces = "text/html;charset=utf-8
    @RequestMapping(value = "/test1",produces = "text/html;charset=utf-8")
    @ResponseBody
    public String test1(@RequestBody User user){
        System.out.println("user = " + user);
        return "发送成功了";
    }
}
